<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <title>常用文档</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="refresh" content="1200">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=86e2297f">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=222aea35">
    <style>
        .title{
            height: 30px;
            line-height: 30px;
            border-bottom: 1px solid #bcbcbe;
            font-size: 14px;
        }
        .list{
            line-height: 24px;
            /*padding-left: 60px;*/
            font-size: 14px;
            color:#333;
            overflow: hidden;
            position: relative;
        }

        .listTitle{
            display: block;
            width: 65px;
            text-align: left;
            left: 0;
            position: absolute;
            top: 10px;

        }
        .listItme{
            color: #228bee;
            margin: 10px 0;

            margin-left: 16px;
            cursor: pointer;
            height: 24px;
            line-height: 23px;
            display: inline-block;
            border: 1px solid #228bee;
            padding: 0 10px;
            text-align: center;
        }
    </style>
</head>
<body>
<section class="content" id="app" v-cloak>
    <div class="myWork iframeHSM" style="height: 131px;">
        <div class="list" v-for="(item,i) in list">
            <div class="module" style="float:left;margin-left: 65px;">
                <span class="listItme" v-for="(item2,b) in item.list" @click="gotoPage(item2.id,item2.typeName)">{{item2.docName}}</span>
            </div>
            <div class="listTitle">{{item.departName}}</div>
        </div>
    </div>
    <!-- /.box-body -->
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=8e743a31"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=54c6b89c"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript">
    console.log(urlConfig);
    var app = new Vue({
        el: '#app',
        data: {
            currentUser: getCurrentUser(),
            selectCom: "",
            selectDep: "",
            key: "",
            list: [],
            companyList: []
        },
        methods: {
            gotoPage:function (id,type) {
                top.closeTabByPageId("openDetail");
                url = "/commonFiles/lookFile.html?fileId=" + id;
                top.addTabs({id: "openDetail", title: "查看文档", close: true, url: url});
            },
            createNewArray:function (arr) {
                var obj = {};
                var result = [];
                arr.forEach(function (element, index) {
                    if (!obj[element.departName]) {
                        obj[element.departName] = [];
                    }
                    obj[element.departName].push(element);
                });

                for (var key in obj) {
                    result.push({
                        departName: key,
                        list: obj[key]
                    });
                }
                return result;
                }
        },
        mounted: function () {
            var that=this;
            $.wyui.postMethod(urlConfig.main.getMainByCompanyId, {companyId:that.currentUser.companyId}, function (r) {
                console.log(r)
                that.list=that.createNewArray(r);
                console.log(that.list)
            });
        }
    });

</script>
</body>
</html>